import { HttpSrv } from 'lfun-bg-comp';
import type { TNewStudents } from './types';
import { ImportParams } from '..';
/** 新生入学管理 */
export class StuNewStudentSrv {
  /** 获取新生入学管理列表 */
  public static async list(params: TNewStudents.TReqNewStudentsParams): Promise<any> {
    return HttpSrv().get(`/school/v1/news-students-view/newstudent`, { params: { ...params } });
  }

  /** 新增关键信息 */
  public static async add(params: TNewStudents.KeyInfo): Promise<any> {
    return HttpSrv().post('/school/v1/news-students-view/newstudent', params);
  }

  /* 关键信息查询 */
  public static async getKeyInfo(student_id: string): Promise<any> {
    return HttpSrv().get('/school/v1/news-students-view/newstudentkeyinfo', { params: { student_id } });
  }

  /* 关键信息更新 */
  public static async updateKeyInfo(params: TNewStudents.KeyInfo): Promise<any> {
    return HttpSrv().put('/school/v1/news-students-view/newstudentkeyinfo', params);
  }

  /* 新生基本信息查询 */
  public static async getBaseinfo(student_id: string): Promise<any> {
    return HttpSrv().get('/school/v1/news-students-info/newstudentbaseinfo', { params: { student_id } });
  }

  /* 新生基本信息更新 */
  public static async updateBaseinfo(params: TNewStudents.BaseInfo): Promise<any> {
    return HttpSrv().put('/school/v1/news-students-info/newstudentbaseinfo', params);
  }

  /* 删除 */
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  public static async delete(student_id: any): Promise<any> {
    return HttpSrv().delete('/school/v1/news-students-view/newstudentkeyinfo', { params: { student_id } });
  }

  /* 分班 */
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  public static async distribute(class_id: any, arr: Array<any>): Promise<any> {
    return HttpSrv().patch(
      `/school/v1/news-students-info/newstudent-classdivision?class_id=${class_id}&student_id=${arr.join(',')}`
    );
  }

  /* 分班查询 */
  public static async distributelist(params: TNewStudents.TReqNewStudentsDisParams): Promise<any> {
    return HttpSrv().get(`/school/v1/news-students-info/newstudent-classdivision`, { params: { ...params } });
  }

  /*流出*/
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  public static async flowout(student_id: any, flow_out_time: string, flow_out_reason: string): Promise<any> {
    return HttpSrv().patch(`/school/v1/news-students-view/newstudent-flowout`, {
      student_id,
      flow_out_time,
      flow_out_reason,
    });
  }

  public static async importNewStudent(params: ImportParams): Promise<any> {
    return HttpSrv().post(`/school/v1/news-students-view/new-student-import`, params);
  }

  // /** 更新 */
  // public static async update(params: any) {
  //   return HttpSrv().patch('/school/v1/news-students-view/newstudentfamilyinfo', params);
  // }

  // /** 删除 */
  // public static async delete(id: any) {
  //   return HttpSrv().delete(`/school/v1/news-students-view/newstudentfamilyinfo?student_id=${id}`);
  // }

  // /** 获取单个新生详情 */
  // public static async detail(id: any) {
  //   return HttpSrv().get(`/school/v1/news-students-view/newstudentbaseinfo?student_id=${id}`);
  // }
}
